# Convert 'm7_first' and 'm7_last' to Date typepd <- result_df %>%mutate(m7_first =as.Date(paste0(m7_first,"-01")),m7_last =as.Date(paste0(m7_last,"-01")))# Reorder 'org' alphabetically and reverse the levels to put the first alphabetically at the toppd$org <-factor(pd$org, levels =rev(sort(unique(pd$org))))# Create a Gantt chartggplot(pd, aes(y = org, x = m7_first, xend = m7_last, yend = org)) +geom_segment(size =6, color ="blue") +theme_minimal() +labs(title ="Gantt Chart of Organizations and Date Ranges", x ="Date", y ="Organization") +theme(axis.text.y =element_text(size =rel(1.5))) # Increased font size for y-axis labels
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
The following object is masked from 'package:lme4':
lmList
The following object is masked from 'package:dplyr':
collapse
This is mgcv 1.9-0. For overview type 'help("mgcv-package")'.
# Create the plottmp |>pivot_longer(cols=c(9:12), names_to="measure", values_to="score") |>ggplot(aes(x=score, y=e_index)) +geom_point(size=0.5) +geom_smooth(method="lm", se=FALSE, linewidth=1.0, color="blue") +# quadratic fitgeom_smooth(method ="lm", formula = y ~poly(x, 2), se =FALSE) +# cubic fitgeom_smooth(method ="lm", formula = y ~poly(x, 3), se =FALSE) +geom_smooth(method ="lm", formula = y ~ splines::bs(x, degree =3), se =FALSE) +geom_smooth(method="loess", se=FALSE, linewidth=1.0, color="red") +geom_smooth(method ="gam") +facet_wrap(~measure, scales="free", nrow =2, ncol =2) +labs(title="Engagement by Sentiment",subtitle="Association Between Engagement and Sentiment",caption="",x="Sentiment",y="Engagement" ) +theme(legend.text =element_text(size =10, face ="bold") )
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ s(x, bs = "cs")'
240118: boxplot measures
org_type_labs=c("culture and recreation","education and research","health","social services ","environment","development and housing","law, advocacy an politics",#"philantropic intermediaries and voluntarism promotion","international")